package cn.yitun.chat.yitunservermanagecore.general.common.menu;

import cn.yitun.chat.yitunservercommonlib.dataentity.po.system.MenuInfo;
import cn.yitun.chat.yitunservercommonlib.enums.system.MenuTypeEnums;

import java.util.ArrayList;
import java.util.List;


/**
 * date 2018-07-12 23:03:26<br>
 * description
 * 
 * @author yitun<br>
 * @since
 */
public class MenuBox {

	public static List<MenuInfo> getRootMenuList() {
		List<MenuInfo> list = new ArrayList<>();

		createMenu(list, 0l, "首页导航");
		createMenu(list, 1l, "个人信息");
		createMenu(list, 2l, "系统权限");
		createMenu(list, 3l, "用户数据");
		return list;
	}

	static void createMenu(List<MenuInfo> list, Long id, String name) {
		createMenu(list, id, name, 0l);
	}

	static void createMenu(List<MenuInfo> list, Long id, String name, Long superId) {

		MenuInfo menu = new MenuInfo();
		menu.setId(id);
		menu.setName(name);
		menu.setIcon("1");
		menu.setParentId(superId);
		menu.setType(MenuTypeEnums.TYPE_MENU.getType());
		list.add(menu);
		menu.setOrderNum(list.indexOf(menu));
	}
}
